Component({
  data: {
    showOption: false,
    selectedValue: '',
    selectedLabel: '',
    options: [
      { label: '选项1', value: 'option1' },
      { label: '选项2', value: 'option2' },
      { label: '选项3', value: 'option3' },
    ]
  },
  methods: {
    toggleDropdown() {
      this.setData({
        showOption: !this.data.showOption,
      });
    },

    selectOption(e) {
      const { value } = e.currentTarget.dataset;
      const selectedOption = this.data.options.find(option => option.value === value);
      this.setData({
        selectedLabel: selectedOption.label,
        selectedValue: selectedOption.value,
        showOption: false,
      });
    }
  }
});